// TerminalTypeOption.cpp: implementation of the CTerminalTypeOption class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "AnsiTerminal.h"
#include "TerminalTypeOption.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif


//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////


void CTerminalTypeOption::SetParameters(const char* buf, int bufLen)
{
	//CString params = CString(buf, bufLen);
	if(bufLen < 1) return;
	if((bufLen == 1) && (buf[0] == SEND))
	{
		CArray<char, char> parameters;
		parameters.Add(IS);
		for(int n = 0; n < m_terminalType.GetLength(); n++)
		{
			parameters.Add(m_terminalType[n]);
		}
		m_pTelnetDataSender->SendOptionParameters(OPTION_TYPE, parameters);
	}
	else if(buf[0] == IS)
	{
		m_terminalType = CString(buf + 1, bufLen - 1);
	}
	else
	{
		// unknown param
		afxDump << "@@@ Unknown Param (CTerminalTypeOption)" << "\n";
		return;
	}
}